//
//  HJLinkPreviewView.m
//  KaiChat
//
//  Created by lx on 2024/4/9.
//

#import "HJLinkPreviewView.h"

@interface HJLinkPreviewView()



@end


@implementation HJLinkPreviewView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        UIImageView *iconImageView = [UIImageView addToView:self];
        iconImageView.addCornerRadius(3);
        iconImageView.contentMode = UIViewContentModeScaleAspectFit;
        [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(10);
            make.top.offset(10);
            make.width.height.offset(20);
        }];
     
        UILabel *linkLabel = [UILabel lableWithSuperView:self font:UIFontMediumMake(14) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
        [linkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(iconImageView.mas_right).offset(10);
            make.centerY.equalTo(iconImageView);
            make.right.inset(10);
        }];
        
        UILabel *titleLabel = [UILabel lableWithSuperView:self font:UIFontMediumMake(12) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
        titleLabel.numberOfLines = 2;
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.inset(10);
            make.top.equalTo(linkLabel.mas_bottom).inset(10);
        }];
        
        UILabel *descriptionLabel = [UILabel lableWithSuperView:self font:UIFontMake(12) color:UIColor.tj_868391Color title:nil textAlignment:NSTextAlignmentLeft];
        descriptionLabel.numberOfLines = 2;
        [descriptionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.inset(10);
            make.top.equalTo(titleLabel.mas_bottom).inset(6);
        }];
        
        _iconImageView = iconImageView;
        _linkLabel = linkLabel;
        _titleLabel = titleLabel;
        _descriptionLabel = descriptionLabel;
    }
    return self;
}

@end
